package com.logistics.inventory.entity.model;

import com.logistics.inventory.entity.domain.Inventory;
import com.logistics.log.entity.domain.Log;
import com.logistics.log.entity.model.LogRow;
import com.logistics.utils.aspect.annotation.Dictionary;
import com.logistics.utils.tool.DateUtils;
import lombok.Data;

@Data
public class InventoryRow {

    private Integer id;
    private String container;
    private Integer containerLevel;
    @Dictionary(key = "container_is_empty")
    private String isEmpty;
    private String agv;
    private String station;
    private String createOrgCode;
    private String createDepCode;
    private String creator;
    private String createTime;
    private String updater;
    private String updateTime;
    private String containerCount;

    public InventoryRow(Inventory inventory) {

        this.id = inventory.getId();
        this.container = inventory.getContainer();
        this.containerLevel = inventory.getContainerLevel();
        this.isEmpty = inventory.getIsEmpty().toString();
        this.agv = inventory.getAgv();
        this.station = inventory.getStation();
        this.createOrgCode = inventory.getCreateOrgCode();
        this.createDepCode = inventory.getCreateDepCode();
        this.creator = inventory.getCreator();
        this.createTime = DateUtils.dateToStringFormat(inventory.getCreateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
        this.updater = inventory.getUpdater();
        this.updateTime = DateUtils.dateToStringFormat(inventory.getUpdateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
        this.containerCount = inventory.getContainerCount();
    }

    public static InventoryRow build(Inventory inventory){
        return new InventoryRow(inventory);
    }
}
